<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org/">
<head>
    <meta charset="UTF-8">
    <title>修改密码页面</title>

    <base href="http://localhost:81/resources/back/">

    <script src="js/AjaxUtlis.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script>
    <script>
        $(function () {
            $("#changPwd").click(function () {
                // 表单校验
                var password = $("#password").val();
                var repassword = $("#repassword").val();
                if(password=="" || repassword==""){
                    layer.msg("请输入密码", {icon: 2,time:1500});
                    return;
                }
                if (password!=repassword){
                    layer.msg("两次密码不相同", {icon: 2,time:1500});
                    return;
                }
                // 获取url中的token
                var token = "[[${#request.getParameter('token')}]]";
                // 封装数据
                var param = new Object();
                param.password = password;
                param.token = token;

                post("auth/changePwd",param,function (resp) {
                    if(resp.code==0){
                        layer.msg(resp.msg, {icon: 1,time:1500},function () {
                            location.href="http://localhost:81/auth/loginUser.html"
                        });
                    }else {
                        layer.msg(rsep.msg, {icon: 2, time: 1000});
                    }
                })
            })
        })
    </script>
</head>
<body>

<h3>修改密码的页面</h3>
密码:<input type="password" id="password" name="password"><br>
确认密码:<input type="password" id="repassword" name="repassword"><br>
<input type="submit" id="changPwd" value="提交">

</body>
</html>